package com.mark.toolImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;


import com.jdbcUtil.JDBCUtil;
import com.mark.database.*;

public class AddMarkImpl {
	//ر 添加收藏1
    public int addMark1(Mark1 m1){
		Connection conn=null;
		PreparedStatement ps=null;
		ResultSet rs=null;
		try{
			conn=JDBCUtil.getConnection();
			String sql="insert into mark1 (uid, job1id) values (?,?);";
			ps=conn.prepareStatement(sql);
			ps.setInt(1, m1.getUid());
			ps.setInt(2, m1.getJobId());
			int i=ps.executeUpdate();
			if(i>=0){
				return 1;
			}
		}catch(Exception e){
			System.out.println(e);
		}finally{
			JDBCUtil.free(conn, ps, rs);
		}
		return -1;
	}
    //ر 添加收藏2
	public int addMark2(Mark2 m2){
		Connection conn=null;
		PreparedStatement ps=null;
		ResultSet rs=null;
		try{
			conn=JDBCUtil.getConnection();
			String sql="insert into mark2 (uid, job2id) values (?,?);";
			ps=conn.prepareStatement(sql);
			ps.setInt(1, m2.getUid());
			ps.setInt(2, m2.getJobId());
			int i=ps.executeUpdate();
			if(i>=0){
				return 1;
			}
		}catch(Exception e){
			System.out.println(e);
		}finally{
			JDBCUtil.free(conn, ps, rs);
		}
		return -1;
	}
}
